package com.example.crm.web.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lenovo
 */
@Configuration
public class FilterConfigs {
    @Bean
    public FilterRegistrationBean filterRegistration(){
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new AuthorizationFilter());
        registration.setName("AuthorizationFilter");
        //作为演示，仅仅只限制/main访问
        registration.addUrlPatterns("/main");
        registration.setOrder(5);
        return registration;
    }
}
